package com.youen.controller;

import com.youen.service.LeftService;
import com.youen.service.TestService;
import com.youen.service.UserService;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

/**
 * Created by Dell on 2018/9/5.
 */
@Controller
@RequestMapping("/test")
public class TestController {

    @Autowired
    private TestService testService;

    @Autowired
    private LeftService leftService;

    @Autowired
    private UserService userService;

    @RequestMapping("/demo")
    public @ResponseBody String test(){
        return userService.findUserByPage("",1,30);
    }

    @GetMapping("/viewDemo")
    public String demo(Map<String, Object> map){
        map.put("aa","aa1111111");
        return "login";
    }

    @PostMapping("/viewLogin")
    public String login(){
        return "main";
    }

    //@PostMapping("/left")
    @RequestMapping(value = "/left", method=RequestMethod.POST)
    public @ResponseBody String lfetText(){
        return leftService.leftText();
    }

    @GetMapping("/viewList")
    public String list(){
        return "user/user";
    }
}
